<template>
  <div>
    <!-- 通过ref拿到子组件组件实例 -->
    <Count ref="countEle"/>
    <hr>
    <h1>父组件接收的值{{List}}</h1>
  </div>
</template>

<script>
import _ from "lodash"

import Count from "./components/count.vue"
export default {
  name: "App",
  components: {
    Count
  },
  data(){
    return{
      List: []
    }
  },

  mounted(){
    //使用$.on给子组件绑定自定义事件
    //参数1：自定义事件名
    //参数2：回调函数
    this.$refs.countEle.$on("atguigu" , (list) =>{
      this.List = _.cloneDeep(list)

      console.log(this.List[0] === list[0]);
    })
  },

};
</script>

<style>
</style>